/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ivanbiz.quiz;

import java.util.List;

/**
 *
 * @author User
 */
public class QuestionServiceImpl implements QuestionService{
    private QuestionDAO questionDAO;

    public void setQuestionDAO(QuestionDAO questionDAO) {
        this.questionDAO = questionDAO;
    }
    
     public void saveQuestion(Question question) throws Exception {
        this.questionDAO.save(question);
    }

    public void deleteQuestion(Question question) throws Exception {
        this.questionDAO.delete(question);
    }

    public void updateQuestion(Question question) throws Exception {
        this.questionDAO.update(question);
    }

    public List loadAll() throws Exception {
        return this.questionDAO.getAll(Question.class);
    }

    public Question loadById(long id) throws Exception {
        return (Question) this.questionDAO.load(Question.class, id);
    }

    public List getQuestionByTitle(long idTitle) throws Exception {
        return this.questionDAO.getQuestionByTitle(idTitle);
    }
}
